<template>
  <div class="search">
    <f-form ref="form" :action="api.bocs" :form-key="this.formItem.settleId" >
      <f-form-item label="订单明细ID"  name="orderDetailsId"    :value="formItem.orderDetailsId" />
      <f-form-item label="订单ID"  name="orderId"    :value="formItem.orderId" />
      <f-form-item label="账套ID"  name="companyId"    :value="formItem.companyId" />
      <f-form-item label="结算金额"  name="settleAmount"    :value="formItem.settleAmount" />
      <f-form-item label="结算日期"  name="settleDate"    :value="formItem.settleDate" />
      <f-form-item label="收款银行"  name="bankId"    :value="formItem.bankId" />
      <f-form-item label="回款ID"  name="returnId"    :value="formItem.returnId" />
      <f-form-item label="客户ID"  name="customId"    :value="formItem.customId" />
      <f-form-item label="供货商ID"  name="supplierId"    :value="formItem.supplierId" />
      <f-form-item label="支付ID"  name="paymentId"    :value="formItem.paymentId" />
      <f-form-item label="结算类型#1:回款结算 2:未回款结算"  name="settleType" dataType="number"   :value="formItem.settleType" />
      <f-form-item label="创建时间"  name="createTime"    :value="formItem.createTime" />
      <f-form-item label="更新时间"  name="updateTime"    :value="formItem.updateTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'bocsForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          settleId: '',
          orderDetailsId: '',
          orderId: '',
          companyId: '',
          settleAmount: '',
          settleDate: '',
          bankId: '',
          returnId: '',
          customId: '',
          supplierId: '',
          paymentId: '',
          settleType: '',
          createTime: '',
          updateTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.settleId) {
          let params={
              settleId:data.settleId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
